<?php

$mytrustdirname = basename( dirname( __FILE__ ) );
$mytrustdirpath = dirname( __FILE__ );

$language = empty($GLOBALS['xoopsConfig']['language']) ? 'english' : $GLOBALS['xoopsConfig']['language'];
$lang_dir = dirname(__FILE__) . '/language/';
if (file_exists($lang_file = $lang_dir . $language . '/main.php') || file_exists($lang_file = $lang_dir . 'english/main.php')) {
    include_once $lang_file;
}

//wanikoo
$modulename = "";
$modulename = $GLOBALS['mydirname'];

$mylinks_theme = "mylinksdefault";

$mylinks_allowed_theme = array("mylinksdefault", "mylinksdefault-RW", "mylinksdefault-LW", "mylinksdefault-BW", "weblinkslike", "weblinkslike-RW", "weblinkslike-LW", "weblinkslike-BW");

if (!empty($_POST['mylinks_theme_select']) && in_array($_POST['mylinks_theme_select'], $mylinks_allowed_theme)) {
       		$mylinks_theme = $_POST['mylinks_theme_select'];
       		$_SESSION[$modulename.'D3UserTheme'] = $_POST['mylinks_theme_select'];
} elseif (!empty($_SESSION[$modulename.'D3UserTheme']) && in_array($_SESSION[$modulename.'D3UserTheme'], $mylinks_allowed_theme)) {
       		$mylinks_theme = $_SESSION[$modulename.'D3UserTheme'];
}

//wanikoo
if( in_array($mylinks_theme, $mylinks_allowed_theme) ) {
$valid_theme = true;
}
else {
$valid_theme = false;
}

$mylinks_wide_theme = false;
$mylinks_right_wide_theme = false;
$mylinks_left_wide_theme = false;
$mylinks_both_wide_theme = false;

if ((strpos($mylinks_theme, '-RW')||strpos($mylinks_theme, '-w')) && ($valid_theme === true)) {
$mylinks_wide_theme = true;
$mylinks_right_wide_theme = true;
}
elseif (strpos($mylinks_theme, '-LW') && ($valid_theme === true)) {
$mylinks_wide_theme = true;
$mylinks_left_wide_theme = true;
}
elseif (strpos($mylinks_theme, '-BW') && ($valid_theme === true)) {
$mylinks_wide_theme = true;
$mylinks_both_wide_theme = true;
}

//wanikoo

define('XOOPSMYLINKURL', XOOPS_URL."/modules/$modulename");
define('XOOPSMYLINKPATH', XOOPS_ROOT_PATH."/modules/$modulename");
define('XOOPSMYLINKINCURL', XOOPSMYLINKURL."/include");
define('XOOPSMYLINKINCPATH', XOOPSMYLINKPATH."/include");
define('XOOPSMYLINKIMGURL', XOOPSMYLINKURL."/images");
define('XOOPSMYLINKIMGPATH', XOOPSMYLINKPATH."/images");

include_once dirname( __FILE__ )."/include/functions.php";

//wanikoo
$mylinks_show_siteinfo = true;
$mylinks_show_extrafunc = true;
if (strpos($GLOBALS['xoopsRequestUri'],'singlelink.php')) {
$mylinks_show_extrafunc_big = true;
}
else {
$mylinks_show_extrafunc_big = false;
}

//ver3.0
$mylinks_show_externalsearch = false;
$mylinks_show_xoopssearch = true;

//ver2.0
$mylinks_show_logo = true;
$mylinks_show_toolbar = true;
$mylinks_show_letters = true;
$mylinks_show_search = true;

//ver3.0
$mylinks_show_feed = true;
$mylinks_show_themechanger = true;

$mylinks_adcodes = array();
$mylinks_adcodes['all'] = '';
$mylinks_adcodes['index'] = '';
$mylinks_adcodes['singlelink'] = '';
$mylinks_adcodes['viewcat'] = '';
$mylinks_adcodes['topten'] = '';
$mylinks_adcodes['ratelink'] = '';
$mylinks_adcodes['modlink'] = '';
$mylinks_adcodes['brokenlink'] = '';
$mylinks_adcodes['submit'] = '';

//wanikoo
// disallow=0, allow =1, memberonly =2
$mylinks_can_print = 1;
$mylinks_can_pdf = 1;
$mylinks_can_bookmark = 1;
//if qrcode module exists 
if ( file_exists(XOOPS_ROOT_PATH."/modules/qrcode/qrcode_image.php") ) {
// disallow=0, allow =1, memberonly =2
$mylinks_can_qrcode = 2;
}
else {
//no qrcode module
$mylinks_can_qrcode = 0;
}

//logo
if ( $mylinks_show_logo && !is_dir(XOOPSMYLINKIMGPATH."/".$mylinks_theme."/logo.gif") && file_exists(XOOPSMYLINKIMGPATH."/".$mylinks_theme."/logo.gif") ) {
	$logoimage = "<a href='".XOOPSMYLINKURL."/index.php'><img src='".XOOPSMYLINKIMGURL."/".$mylinks_theme."/logo.gif' border='0' alt='' /></a>";
}
elseif ( $mylinks_show_logo && !is_dir(XOOPSMYLINKIMGPATH."/logo.gif") && file_exists(XOOPSMYLINKIMGPATH."/logo.gif") ) {
	$logoimage = "<a href='".XOOPSMYLINKURL."/index.php'><img src='".XOOPSMYLINKIMGURL."/logo.gif' border='0' alt='' /></a>";
}
else {
	$logoimage = "";
}

?>